-
Notifications
You must be signed in to change notification settings - Fork 386
Fuzz tests ERC1155 #1348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fuzz tests ERC1155 #1348
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1348 +/- ##
=======================================
Coverage 93.00% 93.00%
=======================================
Files 80 80
Lines 2230 2230
=======================================
Hits 2074 2074
Misses 156 156 Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks good @immrsd, but let's use 0.38.0 feature for fuzzing to avoid the extra boilerplate.
values: Span<u256>, | ||
} | ||
|
||
fn prepare_tokens(ids_len_seed: u32, value_mult_seed: u32) -> TokenList { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to avoid this by using the new Fuzzing derivable trait from foundry 0.38.0. Let's update that before merging this to avoid the extra boilerplate.
packages/testing/src/common.cairo
Outdated
@@ -71,3 +71,13 @@ pub fn assert_entrypoint_not_found_error<T, +Drop<T>>( | |||
panic!("{selector} call was expected to fail, but succeeded"); | |||
} | |||
} | |||
|
|||
/// Creates and returns a new array consisting of the given `element` repeated `n_times` times. | |||
pub fn repeat<T, N, +Copy<T>, +Drop<T>, +Into<N, u256>>(element: T, n_times: N) -> Array<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should export this as part of our external API from testing, it should be an internal test_common item instead. We don't want the testing API to grow to big, so we should include utilities that will be potentially often used, and I think this is not the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Adds fuzz test cases for ERC1155